package com.atguigu.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Demo01 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        //1.添加jar
        //2.加载驱动
        //org.gjt.mm.mysql.Driver
        Class.forName("com.mysql.jdbc.Driver");
        //3.通过驱动管理器获取连接对象
        //3-1.准备URL
        String url = "jdbc:mysql://localhost:3306/fruitdb";
        //3-2.准备用户名
        String user = "root";
        //3-3.准备密码
        String pwd = "12345";
        Connection conn = DriverManager.getConnection(url,user,pwd);

        System.out.println("conn = " + conn);
    }
}
